<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    System.out.println("here is addbook.jsp ,basePath:" + basePath);
%>
<jsp:include page="../commons/common.jsp" flush="true"/>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>addbook page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <base href="<%=basePath%>">
    <style type="text/css">
        #bookname {
            border: 1px solid pink;
        }

        #id {
            border: 1px solid pink;
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#submit").click(function () {
                var id = $("#id").val();
                if (id === '') {
                    alert("请输入图书ID");
                    return;
                }
                var bookname = $("#bookname").val();
                if (bookname === '') {
                    alert("请输入图书名");
                    return;
                }
                var isbn = $("#isbn").val();
                if (isbn === '') {
                    alert("请输入图书编号");
                    return;
                }
                var publisher = $("#publisher").val();
                if (publisher === '') {
                    alert("请输入出版社");
                    return;
                }
                var price = $("#price").val();
                if (price === '') {
                    alert("请输入图书价格");
                    return;
                }
            })
        });

    </script>
</head>

<body>

<div class="am-cf admin-main">
    <!-- sidebar start -->
    <jsp:include page="../commons/menu.jsp" flush="true"/>
    <!-- sidebar end -->

    <!-- content start -->
    <div class="admin-content">
        <ol class="am-breadcrumb">
            <li>位置：<a href="${pageContext.request.contextPath}/system/user/user_list">用户管理</a></li>
            <li class="am-active">用户添加</li>
        </ol>
        <form class="am-form" action="${pageContext.request.contextPath}/BookServlet?operation=addBook" method="post">
            <%--<div class="am-g am-margin-top">--%>
                <%--<div class="am-u-sm-4 am-u-md-2 am-text-right">图书ID</div>--%>
                <%--<div class="am-u-sm-8 am-u-md-4">--%>
                    <%--<input type="text" class="am-input-sm" name="id" id="id" placeholder="请输入图书ID"/>--%>
                <%--</div>--%>
                <%--<div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>--%>
            <%--</div>--%>
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">图书名</div>
                <div class="am-u-sm-8 am-u-md-4">
                    <input type="text" class="am-input-sm" name="bookname" id="bookname" placeholder="请输入图书名"/>
                </div>
                <div class="am-hide-sm-only am-u-md-6">*必填，不可重复</div>
            </div>
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">图书编号</div>
                <div class="am-u-sm-8 am-u-md-4">
                    <input type="text" class="am-input-sm" name="isbn" id="iabn" placeholder="请输入图书编号"/>
                </div>
                <div class="am-hide-sm-only am-u-md-6">必填</div>
            </div>
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">出版社</div>
                <div class="am-u-sm-8 am-u-md-4">
                    <input type="text" class="am-input-sm" name="publisher" id="publisher" placeholder="请输入图书出版社"/>
                </div>
                <div class="am-u-sm-12 am-u-md-6">必填</div>
            </div>
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">图书价格</div>
                <div class="am-u-sm-8 am-u-md-4">
                    <input type="text" class="am-input-sm" name="price" id="price" placeholder="请输入图书价格"/>
                </div>
                <div class="am-hide-sm-only am-u-md-6">必填</div>
            </div>
            <div class="am-g am-margin-top-sm">
                <div class="am-u-sm-12 am-u-md-2 am-text-right admin-form-text">描述</div>
                <div class="am-u-sm-12 am-u-md-10">
                    <textarea rows="5" placeholder="请输入图书描述信息"></textarea>
                </div>
            </div>

            <div class="am-margin">
                <button type="submit" id="submit" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
                <button type="reset" class="am-btn am-btn-warning am-btn-xs">重置</button>
                <button class="am-btn am-btn-danger am-btn-xs"><a href="/pages/book/index.jsp">放弃保存</a></button>
            </div>
        </form>
        <hr>
        <p>© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </div>
    <!-- content end -->
</div>

</body>

</html>
